package cn.swust.designpatternlearningplatform.dao;

import cn.swust.designpatternlearningplatform.dao.sql.StudentTestDaoSql;
import cn.swust.designpatternlearningplatform.domain.bo.TestPaperDataBo;
import cn.swust.designpatternlearningplatform.domain.entity.DailyExercise;
import cn.swust.designpatternlearningplatform.domain.entity.PaperResult;
import cn.swust.designpatternlearningplatform.domain.entity.TestPaper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentTestDao {

    @InsertProvider(type = StudentTestDaoSql.class, method = "insertScore")
    void insertScore(String paperNumber, String studentNumber, Integer sum);

    @InsertProvider(type = StudentTestDaoSql.class, method = "insertDailyExercise")
    void insertDailyExercise(DailyExercise dailyExercise);

    @Results(value = {
            @Result(property = "paperNumber", column = "paper_number"),
            @Result(property = "testName", column = "test_name"),
            @Result(property = "teacherNumber", column = "teacher_number"),
            @Result(property = "startTime", column = "start_time"),
            @Result(property = "endTime", column = "end_time"),
            @Result(property = "doableTime", column = "doable_time"),
            @Result(property = "topicNumber", column = "topic_number"),
            @Result(property = "testScore", column = "testScore"),
            @Result(property = "id", column = "id"),
            @Result(property = "publishTime", column = "publishTime"),
            @Result(property = "isPublish", column = "is_publish"),
            @Result(property = "classNumber", column = "class_number"),
            @Result(property = "semester", column = "semester"),
    })
    @SelectProvider(type = StudentTestDaoSql.class, method = "getTestList")
    List<TestPaper> getTestList(TestPaperDataBo testPaperDataBo);

    /**
     * 批量插入学生做题记录
     *
     * @param dailyExercises
     * @return boolean
     * @author Tang
     * @date 2023/10/12 23:18
     **/
    boolean insertDailyExerciseBatch(@Param("list") List<DailyExercise> dailyExercises);
}
